package shop.ynubeggar.model.dataobject;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import shop.ynubeggar.request.CreateCategoryRequest;

import java.io.Serializable;

/**
 * <p>
 * 商品类别
 * </p>
 *
 * @author LiuQ
 * @since 2022-09-26
 */
@Data
@EqualsAndHashCode(callSuper = false)
@NoArgsConstructor
@AllArgsConstructor
@TableName("category")
public class CategoryDO implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * id
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    /**
     * 店铺id
     */
    private Long shopId;

    /**
     * 类别名称
     */
    private String name;

    /**
     * 父类id
     */
    private Long fatherId;

    public CategoryDO(CreateCategoryRequest createCategoryRequest) {
        this.name = createCategoryRequest.getName();
    }
}
